﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ImageListing.ascx.cs" Inherits="ImageListing" %>

<p></p>
<asp:Button ID="btn_themmoi" runat="server" Text="Thêm mới" 
        onclick="btn_themmoi_Click" /> 
<asp:GridView ID="gvwArticles" runat="server" HorizontalAlign="Left"
    AllowPaging="True" AutoGenerateColumns="False"
   DataKeyNames="ID" DataSourceID="objArticles" 
    Width="100%">
   <Columns>
      <asp:TemplateField HeaderText="Ảnh bìa album">
      <ItemStyle HorizontalAlign="Center" />
         <ItemTemplate>              
               <asp:Image runat="server" class="titleProduct" Height="100px" ImageUrl='<%# Eval("ImageUrl") %>' ID="lnkTitle" /> 
         </ItemTemplate>         
      </asp:TemplateField>
        <asp:TemplateField HeaderText="Tiêu đề album">
         <ItemStyle HorizontalAlign="Center" />
            <ItemTemplate>
                <asp:Literal runat="server" ID="lblTitle" Text='<%#Eval("Title")  %>'  />
            </ItemTemplate>
        </asp:TemplateField>       
      <asp:TemplateField HeaderText="Upload ảnh">
        <ItemStyle HorizontalAlign="Center" />
         <ItemTemplate>
               <asp:HyperLink runat="server" ID="HyperLink1" ToolTip="Upload ảnh"
                  NavigateUrl='<%# "~/Admin/AddEditImage.aspx?ID=" + Eval("ID") %>' ImageUrl="~/Images/upload.jpg" />
         </ItemTemplate>         
      </asp:TemplateField>
      <asp:TemplateField HeaderText="Chỉnh sửa Album">
      <ItemStyle HorizontalAlign="Center" />
         <ItemTemplate>
               <asp:HyperLink runat="server" ID="lnkEdit" ToolTip="Chỉnh sửa Album"
                  NavigateUrl='<%# "~/Admin/AddEditAlbum.aspx?ID=" + Eval("ID") %>' ImageUrl="~/Images/Edit.gif" />
         </ItemTemplate>         
      </asp:TemplateField>  
      <asp:TemplateField HeaderText="Xóa Ablum">
      <ItemStyle HorizontalAlign="Center" />
         <ItemTemplate>
               <asp:ImageButton runat="server" ID="btnDelete" ImageUrl="~/Images/Delete.gif"
                  CommandName="Delete" AlternateText="Delete article"
                  OnClientClick="if (confirm('Bạn có chắc muốn xóa Album này ?') == false) return false;" />
         </ItemTemplate>         
      </asp:TemplateField>                     
   </Columns>   
   <EmptyDataTemplate><b>Chưa có thông tin chia sẻ nào.</b></EmptyDataTemplate>   
</asp:GridView>

<asp:ObjectDataSource ID="objArticles" runat="server" DeleteMethod="DeleteArticle"
   SelectMethod="ListArticles" SelectCountMethod="Articles_GetArticleCount" 
   TypeName="BLL.Article.Article">
   <DeleteParameters>
      <asp:Parameter Name="id" Type="Int32" />
   </DeleteParameters>
   <SelectParameters>
      <asp:Parameter DefaultValue="true" Name="publishedOnly" Type="Boolean" />
      <asp:Parameter Name="categoryID" DefaultValue="2" Type="Int32" />
   </SelectParameters>
</asp:ObjectDataSource>
